package com.itheima.reggie.common;

/**
 * 整个项目的环境对象
 */
public class ApplicationContext {
    private static ThreadLocal threadLocal = new ThreadLocal();

    /**
     * 获取员工的id
     *
     * @return
     */
    public static Long getEmpId() {
        return (Long) threadLocal.get();
    }

    /**
     * 存储员工的id到当前线程的threadLocal
     *
     * @param id
     */
    public static void setEmpId(Long id) {
        threadLocal.set(id);
    }
}
